package com.online.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.online.entity.ExamManage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;

@Mapper
public interface ExamManageMapper {
    /**
     * 分页查询所有试卷
     * @param examManagePage
     * @return
     */
    IPage<ExamManage> findAll(Page<ExamManage> examManagePage);

    /**
     * 根据ID查找考试
     * @param examCode
     * @return
     */
    ExamManage findById(Integer examCode);
    /**
     * 根据id删除考试
     * @param examCode
     * @return
     */
    int deleteById(Integer examCode);

    /**
     * 更新考试信息
     * @param examManage
     * @return
     */
    int update(ExamManage examManage);

    /**
     * 增加考试
     * @param examManage
     * @return
     */
    @Options(useGeneratedKeys = true,keyProperty = "examCode")
    int add(ExamManage examManage);

    /**
     * 查询最后一条记录的paperId,返回给前端达到自增效果
     * @return
     */

    ExamManage findOnlyPaperId();
}
